let app = getApp()
Component({
    properties: {
 
     },
      data:{
        title: "我的内容",
        activeIndex: 0,
        tabList: [ {
            title: "内容",
            value: 1
        }, {
            title: "专栏",
            value: 2
        } ],
        knowledge_type: 1,
        list: [],
        moneySign:'¥'
      },
    lifetimes: {
        attached: function () {
           this.get_data()
       } 
      },
    methods: {
      get_data:function(){
        var that=this
        wx.request({
          url: app.globalData.siteroot,
          data: {
            do:'Knowledge_getKnowledgeOrder',
            knowledge_type:that.data.knowledge_type,
            user_id:wx.getStorageSync('user_id')
          },
          success: function(res) {
            that.setData({
              list:res.data.data
            })
          }
        })
      },
      choose:function(e){
        this.setData({
          knowledge_type:e.detail.cur+1
        })
        this.get_data()
      },
      seriesdetail:function(e){
        var id= e.currentTarget.dataset.id;
        var status= e.currentTarget.dataset.status;
        if(status==2)
        {
            wx.showToast({
              title: "该内容已删除",
              icon: "none"
            })
        }else if(status==3){
          wx.showToast({
            title: "该内容已禁看",
            icon: "none"
          })
        }else{
          wx.navigateTo({ 
            url: '/yb_shopv2/native/all/index?type=series_detail&id='+id
          })
        }
      },
      goToCourse:function(e){
        var status= e.currentTarget.dataset.status;
        var id= e.currentTarget.dataset.id;
        if(status==2)
        {
            wx.showToast({
              title: "该内容已删除",
              icon: "none"
            })
        }else if(status==3){
          wx.showToast({
            title: "该内容已禁看",
            icon: "none"
          })
        }else{
          wx.navigateTo({ 
            url: '/yb_shopv2/native/all/index?type=course_detail&parent_type=2&id='+id
          })
        }
      }
    }
});
